package admin.board.genre.dao;

import java.sql.SQLException;
import java.util.List;

import util.SqlMapLocator;

import admin.board.genre.dto.GenreDto;


public class GenreDao {
	private static GenreDao instance = new GenreDao();
	public static GenreDao getInstance() { return instance; }
	private GenreDao() {}
	
	@SuppressWarnings("unchecked")
	public List<GenreDto> list(int board_no) throws SQLException {
		return (List<GenreDto>)SqlMapLocator.getMapper().queryForList("genre.list", board_no);
	}
	
	public GenreDto selectOne(int genre_no) throws SQLException {
		return (GenreDto)SqlMapLocator.getMapper().queryForObject("genre.selectOne", genre_no);
	}
	
	public void insert(GenreDto dto) throws SQLException {
		SqlMapLocator.getMapper().insert("genre.insert", dto);
	}
	
	public void update(GenreDto dto) throws SQLException {
		SqlMapLocator.getMapper().update("genre.update", dto);
	}
	
	public void delete(int genre_no) throws SQLException {
		SqlMapLocator.getMapper().delete("genre.delete", genre_no);
	}
}
